//#include "stdafx.h"
#include "Query_Preprocessor.h"
#include <vector>
#include <list>
#include <string>
#include <iostream>
using std::vector;
using namespace std;
class QueryEvaluator
{
	
private:
	Query_Preprocessor queryPreprocessor;
	vector<suchThatClause> suchThat;
	struct Result result;
	vector<withClause> with;
	vector<vector<int>> withMapping;

public:
	QueryEvaluator();
	int clearWithMapping();
	int executeQuery(list<string>& resultVector);
	int validateQuery(string Query);
	void generateMapping(int,vector<string>& variables);
	void getEntityMapping(struct Result &result,list<string>& resultVector);
	int getWithMapping(int&,int);
	int intersectResult(struct Result& resultTemp,vector<int>& result1, vector<int>& result2,struct Argument& argument1, struct Argument& argument2,int both);
	int deleteRow(struct Result& resultTemp, int rowIndex); 	
	int checkIndependence(struct Result& tempResult,struct Argument& argument1, struct Argument& argument2,int both);
	int checkEmpty(struct Result& tempResult);
	int deleteAllRows(struct Result& tempResult);
	int clearResult(struct Result& tempResult);

};